package com.probiz.estore.system.service.impl;

import java.math.BigDecimal;

import com.probiz.estore.common.model.system.Wrap;
import com.probiz.estore.core.service.impl.GenericManagerImpl;
import com.probiz.estore.system.dao.WrapDao;


/**
 * Wrap Business Delegate (Proxy) implementation to handle communication between web and
 * persistence layer. Implementation of WrapManager interface.
 * Developer introduced interfaces should be declared here. Won't get overwritten.
 */
public class WrapManagerImpl extends GenericManagerImpl<Wrap> implements com.probiz.estore.system.service.WrapManager {

	private WrapDao wrapDao = null;
	
    public void setWrapDao(WrapDao wrapDao) {
		this.wrapDao = wrapDao;
	}
	/* 
     * @see com.probiz.estore.system.service.WrapManager#calculateWrap(int)
     */
    public BigDecimal doCalculateWrap(Integer wrapCount, Integer wrapId) {
    	Wrap wrap = wrapDao.getById(wrapId);
		BigDecimal price = wrap.getDefaultPrice().multiply(new BigDecimal(wrapCount.toString()));
		return price;
    }
	@Override
	protected void initManager() {
		super.dao = wrapDao;
	}
	@Override
	protected void preDelete(Wrap entity) {
		
	}
	@Override
	protected void preSave(Wrap entity) {
		
	}

}
